"
I am ZnByteEncoder, a concrete subclass of ZnCharacterEncoder.
I handle single byte encodings where byte values 0 to 127 map to ASCII and 128 to 255 are a permutation to Unicode characters.

I derive my mappings by parsing official unicode.org specifications.

The list of encodings and their names/aliases was taken from http://encoding.spec.whatwg.org/#legacy-single-byte-encodings

I basically support ISO/IEC 8859 1, 2, 3, 4, 5, 6, 7, 8, 10, 13, 14, 15 and 16, Windows Codepages 866, 874, 1250, 1251, 1252, 1253, 1253, 1254, 1255, 1256, 1257, 1258, KOI8 R & U as well as Mac Roman & Cyrillic - each of these with a number of aliases like latin1, latin2, latin3, latin4, latin5, latin6, cyrillic, arabic, greek and hebrew. See #mappingToIdentifiers

Note that most/all of these encodings should be considered legacy, with UTF-8 being the preferred encoding going forward.  

Part of Zinc HTTP Components.
"
Class {
	#name : 'ZnByteEncoder',
	#superclass : 'ZnSimplifiedByteEncoder',
	#category : 'Zinc-Character-Encoding-Core',
	#package : 'Zinc-Character-Encoding-Core'
}

{ #category : 'mappings' }
ZnByteEncoder class >> cp1250Mapping [
	"self generateByteToUnicodeSpec: 'http://unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1250.TXT'"

	^ #(
	16r20AC nil 16r201A nil 16r201E 16r2026 16r2020 16r2021
	nil 16r2030 16r0160 16r2039 16r015A 16r0164 16r017D 16r0179
	nil 16r2018 16r2019 16r201C 16r201D 16r2022 16r2013 16r2014
	nil 16r2122 16r0161 16r203A 16r015B 16r0165 16r017E 16r017A
	16r00A0 16r02C7 16r02D8 16r0141 16r00A4 16r0104 16r00A6 16r00A7
	16r00A8 16r00A9 16r015E 16r00AB 16r00AC 16r00AD 16r00AE 16r017B
	16r00B0 16r00B1 16r02DB 16r0142 16r00B4 16r00B5 16r00B6 16r00B7
	16r00B8 16r0105 16r015F 16r00BB 16r013D 16r02DD 16r013E 16r017C
	16r0154 16r00C1 16r00C2 16r0102 16r00C4 16r0139 16r0106 16r00C7
	16r010C 16r00C9 16r0118 16r00CB 16r011A 16r00CD 16r00CE 16r010E
	16r0110 16r0143 16r0147 16r00D3 16r00D4 16r0150 16r00D6 16r00D7
	16r0158 16r016E 16r00DA 16r0170 16r00DC 16r00DD 16r0162 16r00DF
	16r0155 16r00E1 16r00E2 16r0103 16r00E4 16r013A 16r0107 16r00E7
	16r010D 16r00E9 16r0119 16r00EB 16r011B 16r00ED 16r00EE 16r010F
	16r0111 16r0144 16r0148 16r00F3 16r00F4 16r0151 16r00F6 16r00F7
	16r0159 16r016F 16r00FA 16r0171 16r00FC 16r00FD 16r0163 16r02D9 )
]

{ #category : 'mappings' }
ZnByteEncoder class >> cp1251Mapping [
	"self generateByteToUnicodeSpec: 'http://unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1251.TXT'"

	^ #(
	16r0402 16r0403 16r201A 16r0453 16r201E 16r2026 16r2020 16r2021
	16r20AC 16r2030 16r0409 16r2039 16r040A 16r040C 16r040B 16r040F
	16r0452 16r2018 16r2019 16r201C 16r201D 16r2022 16r2013 16r2014
	nil 16r2122 16r0459 16r203A 16r045A 16r045C 16r045B 16r045F
	16r00A0 16r040E 16r045E 16r0408 16r00A4 16r0490 16r00A6 16r00A7
	16r0401 16r00A9 16r0404 16r00AB 16r00AC 16r00AD 16r00AE 16r0407
	16r00B0 16r00B1 16r0406 16r0456 16r0491 16r00B5 16r00B6 16r00B7
	16r0451 16r2116 16r0454 16r00BB 16r0458 16r0405 16r0455 16r0457
	16r0410 16r0411 16r0412 16r0413 16r0414 16r0415 16r0416 16r0417
	16r0418 16r0419 16r041A 16r041B 16r041C 16r041D 16r041E 16r041F
	16r0420 16r0421 16r0422 16r0423 16r0424 16r0425 16r0426 16r0427
	16r0428 16r0429 16r042A 16r042B 16r042C 16r042D 16r042E 16r042F
	16r0430 16r0431 16r0432 16r0433 16r0434 16r0435 16r0436 16r0437
	16r0438 16r0439 16r043A 16r043B 16r043C 16r043D 16r043E 16r043F
	16r0440 16r0441 16r0442 16r0443 16r0444 16r0445 16r0446 16r0447
	16r0448 16r0449 16r044A 16r044B 16r044C 16r044D 16r044E 16r044F )
]

{ #category : 'mappings' }
ZnByteEncoder class >> cp1252Mapping [
	"self generateByteToUnicodeSpec: 'http://unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1252.TXT'"

	^ #(
	16r20AC nil 16r201A 16r0192 16r201E 16r2026 16r2020 16r2021
	16r02C6 16r2030 16r0160 16r2039 16r0152 nil 16r017D nil
	nil 16r2018 16r2019 16r201C 16r201D 16r2022 16r2013 16r2014
	16r02DC 16r2122 16r0161 16r203A 16r0153 nil 16r017E 16r0178
	16r00A0 16r00A1 16r00A2 16r00A3 16r00A4 16r00A5 16r00A6 16r00A7
	16r00A8 16r00A9 16r00AA 16r00AB 16r00AC 16r00AD 16r00AE 16r00AF
	16r00B0 16r00B1 16r00B2 16r00B3 16r00B4 16r00B5 16r00B6 16r00B7
	16r00B8 16r00B9 16r00BA 16r00BB 16r00BC 16r00BD 16r00BE 16r00BF
	16r00C0 16r00C1 16r00C2 16r00C3 16r00C4 16r00C5 16r00C6 16r00C7
	16r00C8 16r00C9 16r00CA 16r00CB 16r00CC 16r00CD 16r00CE 16r00CF
	16r00D0 16r00D1 16r00D2 16r00D3 16r00D4 16r00D5 16r00D6 16r00D7
	16r00D8 16r00D9 16r00DA 16r00DB 16r00DC 16r00DD 16r00DE 16r00DF
	16r00E0 16r00E1 16r00E2 16r00E3 16r00E4 16r00E5 16r00E6 16r00E7
	16r00E8 16r00E9 16r00EA 16r00EB 16r00EC 16r00ED 16r00EE 16r00EF
	16r00F0 16r00F1 16r00F2 16r00F3 16r00F4 16r00F5 16r00F6 16r00F7
	16r00F8 16r00F9 16r00FA 16r00FB 16r00FC 16r00FD 16r00FE 16r00FF )
]

{ #category : 'mappings' }
ZnByteEncoder class >> cp1253Mapping [
	"self generateByteToUnicodeSpec: 'http://unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1253.TXT'"

	^ #(
	16r20AC nil 16r201A 16r0192 16r201E 16r2026 16r2020 16r2021
	nil 16r2030 nil 16r2039 nil nil nil nil
	nil 16r2018 16r2019 16r201C 16r201D 16r2022 16r2013 16r2014
	nil 16r2122 nil 16r203A nil nil nil nil
	16r00A0 16r0385 16r0386 16r00A3 16r00A4 16r00A5 16r00A6 16r00A7
	16r00A8 16r00A9 nil 16r00AB 16r00AC 16r00AD 16r00AE 16r2015
	16r00B0 16r00B1 16r00B2 16r00B3 16r0384 16r00B5 16r00B6 16r00B7
	16r0388 16r0389 16r038A 16r00BB 16r038C 16r00BD 16r038E 16r038F
	16r0390 16r0391 16r0392 16r0393 16r0394 16r0395 16r0396 16r0397
	16r0398 16r0399 16r039A 16r039B 16r039C 16r039D 16r039E 16r039F
	16r03A0 16r03A1 nil 16r03A3 16r03A4 16r03A5 16r03A6 16r03A7
	16r03A8 16r03A9 16r03AA 16r03AB 16r03AC 16r03AD 16r03AE 16r03AF
	16r03B0 16r03B1 16r03B2 16r03B3 16r03B4 16r03B5 16r03B6 16r03B7
	16r03B8 16r03B9 16r03BA 16r03BB 16r03BC 16r03BD 16r03BE 16r03BF
	16r03C0 16r03C1 16r03C2 16r03C3 16r03C4 16r03C5 16r03C6 16r03C7
	16r03C8 16r03C9 16r03CA 16r03CB 16r03CC 16r03CD 16r03CE nil )
]

{ #category : 'mappings' }
ZnByteEncoder class >> cp1254Mapping [
	"self generateByteToUnicodeSpec: 'http://unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1254.TXT'"

	^ #(
	16r20AC nil 16r201A 16r0192 16r201E 16r2026 16r2020 16r2021
	16r02C6 16r2030 16r0160 16r2039 16r0152 nil nil nil
	nil 16r2018 16r2019 16r201C 16r201D 16r2022 16r2013 16r2014
	16r02DC 16r2122 16r0161 16r203A 16r0153 nil nil 16r0178
	16r00A0 16r00A1 16r00A2 16r00A3 16r00A4 16r00A5 16r00A6 16r00A7
	16r00A8 16r00A9 16r00AA 16r00AB 16r00AC 16r00AD 16r00AE 16r00AF
	16r00B0 16r00B1 16r00B2 16r00B3 16r00B4 16r00B5 16r00B6 16r00B7
	16r00B8 16r00B9 16r00BA 16r00BB 16r00BC 16r00BD 16r00BE 16r00BF
	16r00C0 16r00C1 16r00C2 16r00C3 16r00C4 16r00C5 16r00C6 16r00C7
	16r00C8 16r00C9 16r00CA 16r00CB 16r00CC 16r00CD 16r00CE 16r00CF
	16r011E 16r00D1 16r00D2 16r00D3 16r00D4 16r00D5 16r00D6 16r00D7
	16r00D8 16r00D9 16r00DA 16r00DB 16r00DC 16r0130 16r015E 16r00DF
	16r00E0 16r00E1 16r00E2 16r00E3 16r00E4 16r00E5 16r00E6 16r00E7
	16r00E8 16r00E9 16r00EA 16r00EB 16r00EC 16r00ED 16r00EE 16r00EF
	16r011F 16r00F1 16r00F2 16r00F3 16r00F4 16r00F5 16r00F6 16r00F7
	16r00F8 16r00F9 16r00FA 16r00FB 16r00FC 16r0131 16r015F 16r00FF )
]

{ #category : 'mappings' }
ZnByteEncoder class >> cp1255Mapping [
	"self generateByteToUnicodeSpec: 'http://unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1255.TXT'"

	^ #(
	16r20AC nil 16r201A 16r0192 16r201E 16r2026 16r2020 16r2021
	16r02C6 16r2030 nil 16r2039 nil nil nil nil
	nil 16r2018 16r2019 16r201C 16r201D 16r2022 16r2013 16r2014
	16r02DC 16r2122 nil 16r203A nil nil nil nil
	16r00A0 16r00A1 16r00A2 16r00A3 16r20AA 16r00A5 16r00A6 16r00A7
	16r00A8 16r00A9 16r00D7 16r00AB 16r00AC 16r00AD 16r00AE 16r00AF
	16r00B0 16r00B1 16r00B2 16r00B3 16r00B4 16r00B5 16r00B6 16r00B7
	16r00B8 16r00B9 16r00F7 16r00BB 16r00BC 16r00BD 16r00BE 16r00BF
	16r05B0 16r05B1 16r05B2 16r05B3 16r05B4 16r05B5 16r05B6 16r05B7
	16r05B8 16r05B9 nil 16r05BB 16r05BC 16r05BD 16r05BE 16r05BF
	16r05C0 16r05C1 16r05C2 16r05C3 16r05F0 16r05F1 16r05F2 16r05F3
	16r05F4 nil nil nil nil nil nil nil
	16r05D0 16r05D1 16r05D2 16r05D3 16r05D4 16r05D5 16r05D6 16r05D7
	16r05D8 16r05D9 16r05DA 16r05DB 16r05DC 16r05DD 16r05DE 16r05DF
	16r05E0 16r05E1 16r05E2 16r05E3 16r05E4 16r05E5 16r05E6 16r05E7
	16r05E8 16r05E9 16r05EA nil nil 16r200E 16r200F nil )
]

{ #category : 'mappings' }
ZnByteEncoder class >> cp1256Mapping [
	"self generateByteToUnicodeSpec: 'http://unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1256.TXT'"

	^ #(
	16r20AC 16r067E 16r201A 16r0192 16r201E 16r2026 16r2020 16r2021
	16r02C6 16r2030 16r0679 16r2039 16r0152 16r0686 16r0698 16r0688
	16r06AF 16r2018 16r2019 16r201C 16r201D 16r2022 16r2013 16r2014
	16r06A9 16r2122 16r0691 16r203A 16r0153 16r200C 16r200D 16r06BA
	16r00A0 16r060C 16r00A2 16r00A3 16r00A4 16r00A5 16r00A6 16r00A7
	16r00A8 16r00A9 16r06BE 16r00AB 16r00AC 16r00AD 16r00AE 16r00AF
	16r00B0 16r00B1 16r00B2 16r00B3 16r00B4 16r00B5 16r00B6 16r00B7
	16r00B8 16r00B9 16r061B 16r00BB 16r00BC 16r00BD 16r00BE 16r061F
	16r06C1 16r0621 16r0622 16r0623 16r0624 16r0625 16r0626 16r0627
	16r0628 16r0629 16r062A 16r062B 16r062C 16r062D 16r062E 16r062F
	16r0630 16r0631 16r0632 16r0633 16r0634 16r0635 16r0636 16r00D7
	16r0637 16r0638 16r0639 16r063A 16r0640 16r0641 16r0642 16r0643
	16r00E0 16r0644 16r00E2 16r0645 16r0646 16r0647 16r0648 16r00E7
	16r00E8 16r00E9 16r00EA 16r00EB 16r0649 16r064A 16r00EE 16r00EF
	16r064B 16r064C 16r064D 16r064E 16r00F4 16r064F 16r0650 16r00F7
	16r0651 16r00F9 16r0652 16r00FB 16r00FC 16r200E 16r200F 16r06D2 )
]

{ #category : 'mappings' }
ZnByteEncoder class >> cp1257Mapping [
	"self generateByteToUnicodeSpec: 'http://unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1257.TXT'"

	^ #(
	16r20AC nil 16r201A nil 16r201E 16r2026 16r2020 16r2021
	nil 16r2030 nil 16r2039 nil 16r00A8 16r02C7 16r00B8
	nil 16r2018 16r2019 16r201C 16r201D 16r2022 16r2013 16r2014
	nil 16r2122 nil 16r203A nil 16r00AF 16r02DB nil
	16r00A0 nil 16r00A2 16r00A3 16r00A4 nil 16r00A6 16r00A7
	16r00D8 16r00A9 16r0156 16r00AB 16r00AC 16r00AD 16r00AE 16r00C6
	16r00B0 16r00B1 16r00B2 16r00B3 16r00B4 16r00B5 16r00B6 16r00B7
	16r00F8 16r00B9 16r0157 16r00BB 16r00BC 16r00BD 16r00BE 16r00E6
	16r0104 16r012E 16r0100 16r0106 16r00C4 16r00C5 16r0118 16r0112
	16r010C 16r00C9 16r0179 16r0116 16r0122 16r0136 16r012A 16r013B
	16r0160 16r0143 16r0145 16r00D3 16r014C 16r00D5 16r00D6 16r00D7
	16r0172 16r0141 16r015A 16r016A 16r00DC 16r017B 16r017D 16r00DF
	16r0105 16r012F 16r0101 16r0107 16r00E4 16r00E5 16r0119 16r0113
	16r010D 16r00E9 16r017A 16r0117 16r0123 16r0137 16r012B 16r013C
	16r0161 16r0144 16r0146 16r00F3 16r014D 16r00F5 16r00F6 16r00F7
	16r0173 16r0142 16r015B 16r016B 16r00FC 16r017C 16r017E 16r02D9 )
]

{ #category : 'mappings' }
ZnByteEncoder class >> cp1258Mapping [
	"self generateByteToUnicodeSpec: 'http://unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1258.TXT'"

	^ #(
	16r20AC nil 16r201A 16r0192 16r201E 16r2026 16r2020 16r2021
	16r02C6 16r2030 nil 16r2039 16r0152 nil nil nil
	nil 16r2018 16r2019 16r201C 16r201D 16r2022 16r2013 16r2014
	16r02DC 16r2122 nil 16r203A 16r0153 nil nil 16r0178
	16r00A0 16r00A1 16r00A2 16r00A3 16r00A4 16r00A5 16r00A6 16r00A7
	16r00A8 16r00A9 16r00AA 16r00AB 16r00AC 16r00AD 16r00AE 16r00AF
	16r00B0 16r00B1 16r00B2 16r00B3 16r00B4 16r00B5 16r00B6 16r00B7
	16r00B8 16r00B9 16r00BA 16r00BB 16r00BC 16r00BD 16r00BE 16r00BF
	16r00C0 16r00C1 16r00C2 16r0102 16r00C4 16r00C5 16r00C6 16r00C7
	16r00C8 16r00C9 16r00CA 16r00CB 16r0300 16r00CD 16r00CE 16r00CF
	16r0110 16r00D1 16r0309 16r00D3 16r00D4 16r01A0 16r00D6 16r00D7
	16r00D8 16r00D9 16r00DA 16r00DB 16r00DC 16r01AF 16r0303 16r00DF
	16r00E0 16r00E1 16r00E2 16r0103 16r00E4 16r00E5 16r00E6 16r00E7
	16r00E8 16r00E9 16r00EA 16r00EB 16r0301 16r00ED 16r00EE 16r00EF
	16r0111 16r00F1 16r0323 16r00F3 16r00F4 16r01A1 16r00F6 16r00F7
	16r00F8 16r00F9 16r00FA 16r00FB 16r00FC 16r01B0 16r20AB 16r00FF )
]

{ #category : 'mappings' }
ZnByteEncoder class >> cp850Mapping [
	"This is not included in the MS mappings on the Unicode site,
	but still in modern use as the default codepage in
	the Windows Command Shell for multilingual locales"
	"Technically, due to structure of ByteEncoder, it is incomplete,
	as the lower range corresponds not to ASCII, but to cp437,
	where character 0 - 31 and 127 have different meanings."
	"See also http://en.wikipedia.org/wiki/Code_page_850"

	^ #(
	16r00C7 16r00FC 16r00E9 16r00E2 16r00E4 16r00E0 16r00E5 16r00E7
	16r00EA 16r00EB 16r00E8 16r00EF 16r00EE 16r00EC 16r00C4 16r00C5
	16r00C9 16r00E6 16r00C6 16r00F4 16r00F6 16r00F2 16r00FB 16r00F9
	16r00FF 16r00D6 16r00DC 16r00F8 16r00A3 16r00D8 16r00D7 16r0192
	16r00E1 16r00ED 16r00F3 16r00FA 16r00F1 16r00D1 16r00AA 16r00BA
	16r00BF 16r00AE 16r00AC 16r00BD 16r00BC 16r00A1 16r00AB 16r00BB
	16r2591 16r2592 16r2593 16r2502 16r2524 16r00C1 16r00C2 16r00C0
	16r00A9 16r2563 16r2551 16r2557 16r255D 16r00A2 16r00A5 16r2510
	16r2514 16r2534 16r252C 16r251C 16r2500 16r253C 16r00E3 16r00C3
	16r255A 16r2554 16r2569 16r2566 16r2560 16r2550 16r256C 16r00A4
	16r00F0 16r00D0 16r00CA 16r00CB 16r00C8 16r0131 16r00CD 16r00CE
	16r00CF 16r2518 16r250C 16r2588 16r2584 16r00A6 16r00CC 16r2580
	16r00D3 16r00DF 16r00D4 16r00D2 16r00F5 16r00D5 16r00B5 16r00FE
	16r00DE 16r00DA 16r00DB 16r00D9 16r00FD 16r00DD 16r00AF 16r00B4
	16r00AD 16r00B1 16r2017 16r00BE 16r00B6 16r00A7 16r00F7 16r00B8
	16r00B0 16r00A8 16r00B7 16r00B9 16r00B3 16r00B2 16r25A0 16r00A0 )
]

{ #category : 'mappings' }
ZnByteEncoder class >> cp866Mapping [
	"self generateByteToUnicodeSpec: 'http://unicode.org/Public/MAPPINGS/VENDORS/MICSFT/PC/CP866.TXT'"

	^ #(
	16r0410 16r0411 16r0412 16r0413 16r0414 16r0415 16r0416 16r0417
	16r0418 16r0419 16r041A 16r041B 16r041C 16r041D 16r041E 16r041F
	16r0420 16r0421 16r0422 16r0423 16r0424 16r0425 16r0426 16r0427
	16r0428 16r0429 16r042A 16r042B 16r042C 16r042D 16r042E 16r042F
	16r0430 16r0431 16r0432 16r0433 16r0434 16r0435 16r0436 16r0437
	16r0438 16r0439 16r043A 16r043B 16r043C 16r043D 16r043E 16r043F
	16r2591 16r2592 16r2593 16r2502 16r2524 16r2561 16r2562 16r2556
	16r2555 16r2563 16r2551 16r2557 16r255D 16r255C 16r255B 16r2510
	16r2514 16r2534 16r252C 16r251C 16r2500 16r253C 16r255E 16r255F
	16r255A 16r2554 16r2569 16r2566 16r2560 16r2550 16r256C 16r2567
	16r2568 16r2564 16r2565 16r2559 16r2558 16r2552 16r2553 16r256B
	16r256A 16r2518 16r250C 16r2588 16r2584 16r258C 16r2590 16r2580
	16r0440 16r0441 16r0442 16r0443 16r0444 16r0445 16r0446 16r0447
	16r0448 16r0449 16r044A 16r044B 16r044C 16r044D 16r044E 16r044F
	16r0401 16r0451 16r0404 16r0454 16r0407 16r0457 16r040E 16r045E
	16r00B0 16r2219 16r00B7 16r221A 16r2116 16r00A4 16r25A0 16r00A0 )
]

{ #category : 'mappings' }
ZnByteEncoder class >> cp874Mapping [
	"self generateByteToUnicodeSpec: 'http://unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP874.TXT'"

	^ #(
	16r20AC nil nil nil nil 16r2026 nil nil
	nil nil nil nil nil nil nil nil
	nil 16r2018 16r2019 16r201C 16r201D 16r2022 16r2013 16r2014
	nil nil nil nil nil nil nil nil
	16r00A0 16r0E01 16r0E02 16r0E03 16r0E04 16r0E05 16r0E06 16r0E07
	16r0E08 16r0E09 16r0E0A 16r0E0B 16r0E0C 16r0E0D 16r0E0E 16r0E0F
	16r0E10 16r0E11 16r0E12 16r0E13 16r0E14 16r0E15 16r0E16 16r0E17
	16r0E18 16r0E19 16r0E1A 16r0E1B 16r0E1C 16r0E1D 16r0E1E 16r0E1F
	16r0E20 16r0E21 16r0E22 16r0E23 16r0E24 16r0E25 16r0E26 16r0E27
	16r0E28 16r0E29 16r0E2A 16r0E2B 16r0E2C 16r0E2D 16r0E2E 16r0E2F
	16r0E30 16r0E31 16r0E32 16r0E33 16r0E34 16r0E35 16r0E36 16r0E37
	16r0E38 16r0E39 16r0E3A nil nil nil nil 16r0E3F
	16r0E40 16r0E41 16r0E42 16r0E43 16r0E44 16r0E45 16r0E46 16r0E47
	16r0E48 16r0E49 16r0E4A 16r0E4B 16r0E4C 16r0E4D 16r0E4E 16r0E4F
	16r0E50 16r0E51 16r0E52 16r0E53 16r0E54 16r0E55 16r0E56 16r0E57
	16r0E58 16r0E59 16r0E5A 16r0E5B nil nil nil nil )
]

{ #category : 'utilties' }
ZnByteEncoder class >> generateByteToUnicodeSpec: url [
	"Return the formatted source code for an array mapping
	the top 128 byte to unicode values from a Unicode.org url"
	"self generateByteToUnicodeSpec: 'http://unicode.org/Public/MAPPINGS/ISO8859/8859-2.TXT'."

	| mapping |
	mapping := self parseUnicodeOrgSpec: url.
	^ String streamContents: [ :stream |
			stream tab; << '"'; << 'self generateByteToUnicodeSpec: '; print: url; << '"'; cr; cr; tab; << '^ #('.
			(self top128FromUnicodeSpec: mapping) doWithIndex: [ :each :index |
					index - 1 \\ 8 = 0 ifTrue: [ stream cr; tab ].
					each
						ifNil: [ stream print: nil; space ]
						ifNotNil: [ (stream << '16r') << (each printPaddedWith: $0 to: 4 base: 16); space ]
					].
			stream nextPut: $); cr ]
]

{ #category : 'mappings' }
ZnByteEncoder class >> iso885910Mapping [
	"self generateByteToUnicodeSpec: 'http://unicode.org/Public/MAPPINGS/ISO8859/8859-10.TXT'"

	^ #(
	nil nil nil nil nil nil nil nil
	nil nil nil nil nil nil nil nil
	nil nil nil nil nil nil nil nil
	nil nil nil nil nil nil nil nil
	16r00A0 16r0104 16r0112 16r0122 16r012A 16r0128 16r0136 16r00A7
	16r013B 16r0110 16r0160 16r0166 16r017D 16r00AD 16r016A 16r014A
	16r00B0 16r0105 16r0113 16r0123 16r012B 16r0129 16r0137 16r00B7
	16r013C 16r0111 16r0161 16r0167 16r017E 16r2015 16r016B 16r014B
	16r0100 16r00C1 16r00C2 16r00C3 16r00C4 16r00C5 16r00C6 16r012E
	16r010C 16r00C9 16r0118 16r00CB 16r0116 16r00CD 16r00CE 16r00CF
	16r00D0 16r0145 16r014C 16r00D3 16r00D4 16r00D5 16r00D6 16r0168
	16r00D8 16r0172 16r00DA 16r00DB 16r00DC 16r00DD 16r00DE 16r00DF
	16r0101 16r00E1 16r00E2 16r00E3 16r00E4 16r00E5 16r00E6 16r012F
	16r010D 16r00E9 16r0119 16r00EB 16r0117 16r00ED 16r00EE 16r00EF
	16r00F0 16r0146 16r014D 16r00F3 16r00F4 16r00F5 16r00F6 16r0169
	16r00F8 16r0173 16r00FA 16r00FB 16r00FC 16r00FD 16r00FE 16r0138 )
]

{ #category : 'mappings' }
ZnByteEncoder class >> iso885913Mapping [
	"self generateByteToUnicodeSpec: 'http://unicode.org/Public/MAPPINGS/ISO8859/8859-13.TXT'"

	^ #(
	nil nil nil nil nil nil nil nil
	nil nil nil nil nil nil nil nil
	nil nil nil nil nil nil nil nil
	nil nil nil nil nil nil nil nil
	16r00A0 16r201D 16r00A2 16r00A3 16r00A4 16r201E 16r00A6 16r00A7
	16r00D8 16r00A9 16r0156 16r00AB 16r00AC 16r00AD 16r00AE 16r00C6
	16r00B0 16r00B1 16r00B2 16r00B3 16r201C 16r00B5 16r00B6 16r00B7
	16r00F8 16r00B9 16r0157 16r00BB 16r00BC 16r00BD 16r00BE 16r00E6
	16r0104 16r012E 16r0100 16r0106 16r00C4 16r00C5 16r0118 16r0112
	16r010C 16r00C9 16r0179 16r0116 16r0122 16r0136 16r012A 16r013B
	16r0160 16r0143 16r0145 16r00D3 16r014C 16r00D5 16r00D6 16r00D7
	16r0172 16r0141 16r015A 16r016A 16r00DC 16r017B 16r017D 16r00DF
	16r0105 16r012F 16r0101 16r0107 16r00E4 16r00E5 16r0119 16r0113
	16r010D 16r00E9 16r017A 16r0117 16r0123 16r0137 16r012B 16r013C
	16r0161 16r0144 16r0146 16r00F3 16r014D 16r00F5 16r00F6 16r00F7
	16r0173 16r0142 16r015B 16r016B 16r00FC 16r017C 16r017E 16r2019 )
]

{ #category : 'mappings' }
ZnByteEncoder class >> iso885914Mapping [
	"self generateByteToUnicodeSpec: 'http://unicode.org/Public/MAPPINGS/ISO8859/8859-14.TXT'"

	^ #(
	nil nil nil nil nil nil nil nil
	nil nil nil nil nil nil nil nil
	nil nil nil nil nil nil nil nil
	nil nil nil nil nil nil nil nil
	16r00A0 16r1E02 16r1E03 16r00A3 16r010A 16r010B 16r1E0A 16r00A7
	16r1E80 16r00A9 16r1E82 16r1E0B 16r1EF2 16r00AD 16r00AE 16r0178
	16r1E1E 16r1E1F 16r0120 16r0121 16r1E40 16r1E41 16r00B6 16r1E56
	16r1E81 16r1E57 16r1E83 16r1E60 16r1EF3 16r1E84 16r1E85 16r1E61
	16r00C0 16r00C1 16r00C2 16r00C3 16r00C4 16r00C5 16r00C6 16r00C7
	16r00C8 16r00C9 16r00CA 16r00CB 16r00CC 16r00CD 16r00CE 16r00CF
	16r0174 16r00D1 16r00D2 16r00D3 16r00D4 16r00D5 16r00D6 16r1E6A
	16r00D8 16r00D9 16r00DA 16r00DB 16r00DC 16r00DD 16r0176 16r00DF
	16r00E0 16r00E1 16r00E2 16r00E3 16r00E4 16r00E5 16r00E6 16r00E7
	16r00E8 16r00E9 16r00EA 16r00EB 16r00EC 16r00ED 16r00EE 16r00EF
	16r0175 16r00F1 16r00F2 16r00F3 16r00F4 16r00F5 16r00F6 16r1E6B
	16r00F8 16r00F9 16r00FA 16r00FB 16r00FC 16r00FD 16r0177 16r00FF )
]

{ #category : 'mappings' }
ZnByteEncoder class >> iso885915Mapping [
	"self generateByteToUnicodeSpec: 'http://unicode.org/Public/MAPPINGS/ISO8859/8859-15.TXT'"

	^ #(
	nil nil nil nil nil nil nil nil
	nil nil nil nil nil nil nil nil
	nil nil nil nil nil nil nil nil
	nil nil nil nil nil nil nil nil
	16r00A0 16r00A1 16r00A2 16r00A3 16r20AC 16r00A5 16r0160 16r00A7
	16r0161 16r00A9 16r00AA 16r00AB 16r00AC 16r00AD 16r00AE 16r00AF
	16r00B0 16r00B1 16r00B2 16r00B3 16r017D 16r00B5 16r00B6 16r00B7
	16r017E 16r00B9 16r00BA 16r00BB 16r0152 16r0153 16r0178 16r00BF
	16r00C0 16r00C1 16r00C2 16r00C3 16r00C4 16r00C5 16r00C6 16r00C7
	16r00C8 16r00C9 16r00CA 16r00CB 16r00CC 16r00CD 16r00CE 16r00CF
	16r00D0 16r00D1 16r00D2 16r00D3 16r00D4 16r00D5 16r00D6 16r00D7
	16r00D8 16r00D9 16r00DA 16r00DB 16r00DC 16r00DD 16r00DE 16r00DF
	16r00E0 16r00E1 16r00E2 16r00E3 16r00E4 16r00E5 16r00E6 16r00E7
	16r00E8 16r00E9 16r00EA 16r00EB 16r00EC 16r00ED 16r00EE 16r00EF
	16r00F0 16r00F1 16r00F2 16r00F3 16r00F4 16r00F5 16r00F6 16r00F7
	16r00F8 16r00F9 16r00FA 16r00FB 16r00FC 16r00FD 16r00FE 16r00FF )
]

{ #category : 'mappings' }
ZnByteEncoder class >> iso885916Mapping [
	"self generateByteToUnicodeSpec: 'http://unicode.org/Public/MAPPINGS/ISO8859/8859-16.TXT'"

	^ #(
	nil nil nil nil nil nil nil nil
	nil nil nil nil nil nil nil nil
	nil nil nil nil nil nil nil nil
	nil nil nil nil nil nil nil nil
	16r00A0 16r0104 16r0105 16r0141 16r20AC 16r201E 16r0160 16r00A7
	16r0161 16r00A9 16r0218 16r00AB 16r0179 16r00AD 16r017A 16r017B
	16r00B0 16r00B1 16r010C 16r0142 16r017D 16r201D 16r00B6 16r00B7
	16r017E 16r010D 16r0219 16r00BB 16r0152 16r0153 16r0178 16r017C
	16r00C0 16r00C1 16r00C2 16r0102 16r00C4 16r0106 16r00C6 16r00C7
	16r00C8 16r00C9 16r00CA 16r00CB 16r00CC 16r00CD 16r00CE 16r00CF
	16r0110 16r0143 16r00D2 16r00D3 16r00D4 16r0150 16r00D6 16r015A
	16r0170 16r00D9 16r00DA 16r00DB 16r00DC 16r0118 16r021A 16r00DF
	16r00E0 16r00E1 16r00E2 16r0103 16r00E4 16r0107 16r00E6 16r00E7
	16r00E8 16r00E9 16r00EA 16r00EB 16r00EC 16r00ED 16r00EE 16r00EF
	16r0111 16r0144 16r00F2 16r00F3 16r00F4 16r0151 16r00F6 16r015B
	16r0171 16r00F9 16r00FA 16r00FB 16r00FC 16r0119 16r021B 16r00FF )
]

{ #category : 'mappings' }
ZnByteEncoder class >> iso88592Mapping [
	"self generateByteToUnicodeSpec: 'http://unicode.org/Public/MAPPINGS/ISO8859/8859-2.TXT'"

	^ #(
	nil nil nil nil nil nil nil nil
	nil nil nil nil nil nil nil nil
	nil nil nil nil nil nil nil nil
	nil nil nil nil nil nil nil nil
	16r00A0 16r0104 16r02D8 16r0141 16r00A4 16r013D 16r015A 16r00A7
	16r00A8 16r0160 16r015E 16r0164 16r0179 16r00AD 16r017D 16r017B
	16r00B0 16r0105 16r02DB 16r0142 16r00B4 16r013E 16r015B 16r02C7
	16r00B8 16r0161 16r015F 16r0165 16r017A 16r02DD 16r017E 16r017C
	16r0154 16r00C1 16r00C2 16r0102 16r00C4 16r0139 16r0106 16r00C7
	16r010C 16r00C9 16r0118 16r00CB 16r011A 16r00CD 16r00CE 16r010E
	16r0110 16r0143 16r0147 16r00D3 16r00D4 16r0150 16r00D6 16r00D7
	16r0158 16r016E 16r00DA 16r0170 16r00DC 16r00DD 16r0162 16r00DF
	16r0155 16r00E1 16r00E2 16r0103 16r00E4 16r013A 16r0107 16r00E7
	16r010D 16r00E9 16r0119 16r00EB 16r011B 16r00ED 16r00EE 16r010F
	16r0111 16r0144 16r0148 16r00F3 16r00F4 16r0151 16r00F6 16r00F7
	16r0159 16r016F 16r00FA 16r0171 16r00FC 16r00FD 16r0163 16r02D9 )
]

{ #category : 'mappings' }
ZnByteEncoder class >> iso88593Mapping [
	"self generateByteToUnicodeSpec: 'http://unicode.org/Public/MAPPINGS/ISO8859/8859-3.TXT'"

	^ #(
	nil nil nil nil nil nil nil nil
	nil nil nil nil nil nil nil nil
	nil nil nil nil nil nil nil nil
	nil nil nil nil nil nil nil nil
	16r00A0 16r0126 16r02D8 16r00A3 16r00A4 nil 16r0124 16r00A7
	16r00A8 16r0130 16r015E 16r011E 16r0134 16r00AD nil 16r017B
	16r00B0 16r0127 16r00B2 16r00B3 16r00B4 16r00B5 16r0125 16r00B7
	16r00B8 16r0131 16r015F 16r011F 16r0135 16r00BD nil 16r017C
	16r00C0 16r00C1 16r00C2 nil 16r00C4 16r010A 16r0108 16r00C7
	16r00C8 16r00C9 16r00CA 16r00CB 16r00CC 16r00CD 16r00CE 16r00CF
	nil 16r00D1 16r00D2 16r00D3 16r00D4 16r0120 16r00D6 16r00D7
	16r011C 16r00D9 16r00DA 16r00DB 16r00DC 16r016C 16r015C 16r00DF
	16r00E0 16r00E1 16r00E2 nil 16r00E4 16r010B 16r0109 16r00E7
	16r00E8 16r00E9 16r00EA 16r00EB 16r00EC 16r00ED 16r00EE 16r00EF
	nil 16r00F1 16r00F2 16r00F3 16r00F4 16r0121 16r00F6 16r00F7
	16r011D 16r00F9 16r00FA 16r00FB 16r00FC 16r016D 16r015D 16r02D9 )
]

{ #category : 'mappings' }
ZnByteEncoder class >> iso88594Mapping [
	"self generateByteToUnicodeSpec: 'http://unicode.org/Public/MAPPINGS/ISO8859/8859-4.TXT'"

	^ #(
	nil nil nil nil nil nil nil nil
	nil nil nil nil nil nil nil nil
	nil nil nil nil nil nil nil nil
	nil nil nil nil nil nil nil nil
	16r00A0 16r0104 16r0138 16r0156 16r00A4 16r0128 16r013B 16r00A7
	16r00A8 16r0160 16r0112 16r0122 16r0166 16r00AD 16r017D 16r00AF
	16r00B0 16r0105 16r02DB 16r0157 16r00B4 16r0129 16r013C 16r02C7
	16r00B8 16r0161 16r0113 16r0123 16r0167 16r014A 16r017E 16r014B
	16r0100 16r00C1 16r00C2 16r00C3 16r00C4 16r00C5 16r00C6 16r012E
	16r010C 16r00C9 16r0118 16r00CB 16r0116 16r00CD 16r00CE 16r012A
	16r0110 16r0145 16r014C 16r0136 16r00D4 16r00D5 16r00D6 16r00D7
	16r00D8 16r0172 16r00DA 16r00DB 16r00DC 16r0168 16r016A 16r00DF
	16r0101 16r00E1 16r00E2 16r00E3 16r00E4 16r00E5 16r00E6 16r012F
	16r010D 16r00E9 16r0119 16r00EB 16r0117 16r00ED 16r00EE 16r012B
	16r0111 16r0146 16r014D 16r0137 16r00F4 16r00F5 16r00F6 16r00F7
	16r00F8 16r0173 16r00FA 16r00FB 16r00FC 16r0169 16r016B 16r02D9 )
]

{ #category : 'mappings' }
ZnByteEncoder class >> iso88595Mapping [
	"self generateByteToUnicodeSpec: 'http://unicode.org/Public/MAPPINGS/ISO8859/8859-5.TXT'"

	^ #(
	nil nil nil nil nil nil nil nil
	nil nil nil nil nil nil nil nil
	nil nil nil nil nil nil nil nil
	nil nil nil nil nil nil nil nil
	16r00A0 16r0401 16r0402 16r0403 16r0404 16r0405 16r0406 16r0407
	16r0408 16r0409 16r040A 16r040B 16r040C 16r00AD 16r040E 16r040F
	16r0410 16r0411 16r0412 16r0413 16r0414 16r0415 16r0416 16r0417
	16r0418 16r0419 16r041A 16r041B 16r041C 16r041D 16r041E 16r041F
	16r0420 16r0421 16r0422 16r0423 16r0424 16r0425 16r0426 16r0427
	16r0428 16r0429 16r042A 16r042B 16r042C 16r042D 16r042E 16r042F
	16r0430 16r0431 16r0432 16r0433 16r0434 16r0435 16r0436 16r0437
	16r0438 16r0439 16r043A 16r043B 16r043C 16r043D 16r043E 16r043F
	16r0440 16r0441 16r0442 16r0443 16r0444 16r0445 16r0446 16r0447
	16r0448 16r0449 16r044A 16r044B 16r044C 16r044D 16r044E 16r044F
	16r2116 16r0451 16r0452 16r0453 16r0454 16r0455 16r0456 16r0457
	16r0458 16r0459 16r045A 16r045B 16r045C 16r00A7 16r045E 16r045F )
]

{ #category : 'mappings' }
ZnByteEncoder class >> iso88596Mapping [
	"self generateByteToUnicodeSpec: 'http://unicode.org/Public/MAPPINGS/ISO8859/8859-6.TXT'"

	^ #(
	nil nil nil nil nil nil nil nil
	nil nil nil nil nil nil nil nil
	nil nil nil nil nil nil nil nil
	nil nil nil nil nil nil nil nil
	16r00A0 nil nil nil 16r00A4 nil nil nil
	nil nil nil nil 16r060C 16r00AD nil nil
	nil nil nil nil nil nil nil nil
	nil nil nil 16r061B nil nil nil 16r061F
	nil 16r0621 16r0622 16r0623 16r0624 16r0625 16r0626 16r0627
	16r0628 16r0629 16r062A 16r062B 16r062C 16r062D 16r062E 16r062F
	16r0630 16r0631 16r0632 16r0633 16r0634 16r0635 16r0636 16r0637
	16r0638 16r0639 16r063A nil nil nil nil nil
	16r0640 16r0641 16r0642 16r0643 16r0644 16r0645 16r0646 16r0647
	16r0648 16r0649 16r064A 16r064B 16r064C 16r064D 16r064E 16r064F
	16r0650 16r0651 16r0652 nil nil nil nil nil
	nil nil nil nil nil nil nil nil )
]

{ #category : 'mappings' }
ZnByteEncoder class >> iso88597Mapping [
	"self generateByteToUnicodeSpec: 'http://unicode.org/Public/MAPPINGS/ISO8859/8859-7.TXT'"

	^ #(
	nil nil nil nil nil nil nil nil
	nil nil nil nil nil nil nil nil
	nil nil nil nil nil nil nil nil
	nil nil nil nil nil nil nil nil
	16r00A0 16r2018 16r2019 16r00A3 16r20AC 16r20AF 16r00A6 16r00A7
	16r00A8 16r00A9 16r037A 16r00AB 16r00AC 16r00AD nil 16r2015
	16r00B0 16r00B1 16r00B2 16r00B3 16r0384 16r0385 16r0386 16r00B7
	16r0388 16r0389 16r038A 16r00BB 16r038C 16r00BD 16r038E 16r038F
	16r0390 16r0391 16r0392 16r0393 16r0394 16r0395 16r0396 16r0397
	16r0398 16r0399 16r039A 16r039B 16r039C 16r039D 16r039E 16r039F
	16r03A0 16r03A1 nil 16r03A3 16r03A4 16r03A5 16r03A6 16r03A7
	16r03A8 16r03A9 16r03AA 16r03AB 16r03AC 16r03AD 16r03AE 16r03AF
	16r03B0 16r03B1 16r03B2 16r03B3 16r03B4 16r03B5 16r03B6 16r03B7
	16r03B8 16r03B9 16r03BA 16r03BB 16r03BC 16r03BD 16r03BE 16r03BF
	16r03C0 16r03C1 16r03C2 16r03C3 16r03C4 16r03C5 16r03C6 16r03C7
	16r03C8 16r03C9 16r03CA 16r03CB 16r03CC 16r03CD 16r03CE nil )
]

{ #category : 'mappings' }
ZnByteEncoder class >> iso88598Mapping [
	"self generateByteToUnicodeSpec: 'http://unicode.org/Public/MAPPINGS/ISO8859/8859-8.TXT'"

	^ #(
	nil nil nil nil nil nil nil nil
	nil nil nil nil nil nil nil nil
	nil nil nil nil nil nil nil nil
	nil nil nil nil nil nil nil nil
	16r00A0 nil 16r00A2 16r00A3 16r00A4 16r00A5 16r00A6 16r00A7
	16r00A8 16r00A9 16r00D7 16r00AB 16r00AC 16r00AD 16r00AE 16r00AF
	16r00B0 16r00B1 16r00B2 16r00B3 16r00B4 16r00B5 16r00B6 16r00B7
	16r00B8 16r00B9 16r00F7 16r00BB 16r00BC 16r00BD 16r00BE nil
	nil nil nil nil nil nil nil nil
	nil nil nil nil nil nil nil nil
	nil nil nil nil nil nil nil nil
	nil nil nil nil nil nil nil 16r2017
	16r05D0 16r05D1 16r05D2 16r05D3 16r05D4 16r05D5 16r05D6 16r05D7
	16r05D8 16r05D9 16r05DA 16r05DB 16r05DC 16r05DD 16r05DE 16r05DF
	16r05E0 16r05E1 16r05E2 16r05E3 16r05E4 16r05E5 16r05E6 16r05E7
	16r05E8 16r05E9 16r05EA nil nil 16r200E 16r200F nil )
]

{ #category : 'mappings' }
ZnByteEncoder class >> koi8rMapping [
	"self generateByteToUnicodeSpec: 'http://unicode.org/Public/MAPPINGS/VENDORS/MISC/KOI8-R.TXT'"

	^ #(
	16r2500 16r2502 16r250C 16r2510 16r2514 16r2518 16r251C 16r2524
	16r252C 16r2534 16r253C 16r2580 16r2584 16r2588 16r258C 16r2590
	16r2591 16r2592 16r2593 16r2320 16r25A0 16r2219 16r221A 16r2248
	16r2264 16r2265 16r00A0 16r2321 16r00B0 16r00B2 16r00B7 16r00F7
	16r2550 16r2551 16r2552 16r0451 16r2553 16r2554 16r2555 16r2556
	16r2557 16r2558 16r2559 16r255A 16r255B 16r255C 16r255D 16r255E
	16r255F 16r2560 16r2561 16r0401 16r2562 16r2563 16r2564 16r2565
	16r2566 16r2567 16r2568 16r2569 16r256A 16r256B 16r256C 16r00A9
	16r044E 16r0430 16r0431 16r0446 16r0434 16r0435 16r0444 16r0433
	16r0445 16r0438 16r0439 16r043A 16r043B 16r043C 16r043D 16r043E
	16r043F 16r044F 16r0440 16r0441 16r0442 16r0443 16r0436 16r0432
	16r044C 16r044B 16r0437 16r0448 16r044D 16r0449 16r0447 16r044A
	16r042E 16r0410 16r0411 16r0426 16r0414 16r0415 16r0424 16r0413
	16r0425 16r0418 16r0419 16r041A 16r041B 16r041C 16r041D 16r041E
	16r041F 16r042F 16r0420 16r0421 16r0422 16r0423 16r0416 16r0412
	16r042C 16r042B 16r0417 16r0428 16r042D 16r0429 16r0427 16r042A )
]

{ #category : 'mappings' }
ZnByteEncoder class >> koi8uMapping [
	"self generateByteToUnicodeSpec: 'http://unicode.org/Public/MAPPINGS/VENDORS/MISC/KOI8-U.TXT'"

	^ #(
	16r2500 16r2502 16r250C 16r2510 16r2514 16r2518 16r251C 16r2524
	16r252C 16r2534 16r253C 16r2580 16r2584 16r2588 16r258C 16r2590
	16r2591 16r2592 16r2593 16r2320 16r25A0 16r2219 16r221A 16r2248
	16r2264 16r2265 16r00A0 16r2321 16r00B0 16r00B2 16r00B7 16r00F7
	16r2550 16r2551 16r2552 16r0451 16r0454 16r2554 16r0456 16r0457
	16r2557 16r2558 16r2559 16r255A 16r255B 16r0491 16r255D 16r255E
	16r255F 16r2560 16r2561 16r0401 16r0404 16r2563 16r0406 16r0407
	16r2566 16r2567 16r2568 16r2569 16r256A 16r0490 16r256C 16r00A9
	16r044E 16r0430 16r0431 16r0446 16r0434 16r0435 16r0444 16r0433
	16r0445 16r0438 16r0439 16r043A 16r043B 16r043C 16r043D 16r043E
	16r043F 16r044F 16r0440 16r0441 16r0442 16r0443 16r0436 16r0432
	16r044C 16r044B 16r0437 16r0448 16r044D 16r0449 16r0447 16r044A
	16r042E 16r0410 16r0411 16r0426 16r0414 16r0415 16r0424 16r0413
	16r0425 16r0418 16r0419 16r041A 16r041B 16r041C 16r041D 16r041E
	16r041F 16r042F 16r0420 16r0421 16r0422 16r0423 16r0416 16r0412
	16r042C 16r042B 16r0417 16r0428 16r042D 16r0429 16r0427 16r042A )
]

{ #category : 'mappings' }
ZnByteEncoder class >> macCyrillicMapping [
	"self generateByteToUnicodeSpec: 'http://unicode.org/Public/MAPPINGS/VENDORS/APPLE/CYRILLIC.TXT'"

	^ #(
	16r0410 16r0411 16r0412 16r0413 16r0414 16r0415 16r0416 16r0417
	16r0418 16r0419 16r041A 16r041B 16r041C 16r041D 16r041E 16r041F
	16r0420 16r0421 16r0422 16r0423 16r0424 16r0425 16r0426 16r0427
	16r0428 16r0429 16r042A 16r042B 16r042C 16r042D 16r042E 16r042F
	16r2020 16r00B0 16r0490 16r00A3 16r00A7 16r2022 16r00B6 16r0406
	16r00AE 16r00A9 16r2122 16r0402 16r0452 16r2260 16r0403 16r0453
	16r221E 16r00B1 16r2264 16r2265 16r0456 16r00B5 16r0491 16r0408
	16r0404 16r0454 16r0407 16r0457 16r0409 16r0459 16r040A 16r045A
	16r0458 16r0405 16r00AC 16r221A 16r0192 16r2248 16r2206 16r00AB
	16r00BB 16r2026 16r00A0 16r040B 16r045B 16r040C 16r045C 16r0455
	16r2013 16r2014 16r201C 16r201D 16r2018 16r2019 16r00F7 16r201E
	16r040E 16r045E 16r040F 16r045F 16r2116 16r0401 16r0451 16r044F
	16r0430 16r0431 16r0432 16r0433 16r0434 16r0435 16r0436 16r0437
	16r0438 16r0439 16r043A 16r043B 16r043C 16r043D 16r043E 16r043F
	16r0440 16r0441 16r0442 16r0443 16r0444 16r0445 16r0446 16r0447
	16r0448 16r0449 16r044A 16r044B 16r044C 16r044D 16r044E 16r20AC )
]

{ #category : 'mappings' }
ZnByteEncoder class >> macRomanMapping [
	"self generateByteToUnicodeSpec: 'http://unicode.org/Public/MAPPINGS/VENDORS/APPLE/ROMAN.TXT'"

	^ #(
	16r00C4 16r00C5 16r00C7 16r00C9 16r00D1 16r00D6 16r00DC 16r00E1
	16r00E0 16r00E2 16r00E4 16r00E3 16r00E5 16r00E7 16r00E9 16r00E8
	16r00EA 16r00EB 16r00ED 16r00EC 16r00EE 16r00EF 16r00F1 16r00F3
	16r00F2 16r00F4 16r00F6 16r00F5 16r00FA 16r00F9 16r00FB 16r00FC
	16r2020 16r00B0 16r00A2 16r00A3 16r00A7 16r2022 16r00B6 16r00DF
	16r00AE 16r00A9 16r2122 16r00B4 16r00A8 16r2260 16r00C6 16r00D8
	16r221E 16r00B1 16r2264 16r2265 16r00A5 16r00B5 16r2202 16r2211
	16r220F 16r03C0 16r222B 16r00AA 16r00BA 16r03A9 16r00E6 16r00F8
	16r00BF 16r00A1 16r00AC 16r221A 16r0192 16r2248 16r2206 16r00AB
	16r00BB 16r2026 16r00A0 16r00C0 16r00C3 16r00D5 16r0152 16r0153
	16r2013 16r2014 16r201C 16r201D 16r2018 16r2019 16r00F7 16r25CA
	16r00FF 16r0178 16r2044 16r20AC 16r2039 16r203A 16rFB01 16rFB02
	16r2021 16r00B7 16r201A 16r201E 16r2030 16r00C2 16r00CA 16r00C1
	16r00CB 16r00C8 16r00CD 16r00CE 16r00CF 16r00CC 16r00D3 16r00D4
	16rF8FF 16r00D2 16r00DA 16r00DB 16r00D9 16r0131 16r02C6 16r02DC
	16r00AF 16r02D8 16r02D9 16r02DA 16r00B8 16r02DD 16r02DB 16r02C7 )
]

{ #category : 'mappings' }
ZnByteEncoder class >> mappingToIdentifiers [
	"Return a dictionay mapping from encoding specifications to a list of encoding names."

	^ Dictionary newFromPairs: #(
		"#asciiMapping #('ascii')"
		"#iso88591Mapping #('iso88591' 'latin1')"
		#iso88592Mapping #('iso88592' 'latin2')
		#iso88593Mapping #('iso88593' 'latin3')
		#iso88594Mapping #('iso88594' 'latin4')
		#iso88595Mapping #('iso88595' 'cyrillic')
		#iso88596Mapping #('iso88596' 'arabic')
		#iso88597Mapping #('iso88597' 'greek')
		#iso88598Mapping #('iso88598' 'hebrew')
		#iso885910Mapping #('iso885910' 'latin6')
		#iso885913Mapping #('iso885913')
		#iso885914Mapping #('iso885914')
		#iso885915Mapping #('iso885915')
		#iso885916Mapping #('iso885916')
		#cp1250Mapping #('cp1250' 'windows1250' 'xcp1250')
		#cp1251Mapping #('cp1251' 'windows1251' 'xcp1251')
		#cp1252Mapping #('cp1252' 'windows1252' 'xcp1252' 'ibm819')
		#cp1253Mapping #('cp1253' 'windows1253' 'xcp1253')
		#cp1254Mapping #('cp1254' 'windows1254' 'xcp1254' 'iso88599' 'latin5')
		#cp1255Mapping #('cp1255' 'windows1255' 'xcp1255')
		#cp1256Mapping #('cp1256' 'windows1256' 'xcp1256')
		#cp1257Mapping #('cp1257' 'windows1257' 'xcp1257')
		#cp1258Mapping #('cp1258' 'windows1258' 'xcp1258')
		#cp850Mapping #('cp850' 'ibm850' 'oem850' 'doslatin1')
		#cp866Mapping #('cp866' 'ibm866')
		#cp874Mapping #('cp874' 'iso885911' 'windows874' 'dos874')
		#koi8rMapping #('koi8r' 'koi8')
		#koi8uMapping #('koi8u')
		#macRomanMapping #('macroman' 'xmacroman' 'mac' 'macintosh')
		#macCyrillicMapping #('maccyrillic' 'xmaccyrillic') )
]

{ #category : 'instance creation' }
ZnByteEncoder class >> newFromUrl: url [
	"Instanciate a new encoder directly from a Unicode.org url"
	"self newFromUrl: 'http://unicode.org/Public/MAPPINGS/ISO8859/8859-2.TXT'"
	"self newFromUrl: 'http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/PC/CP437.TXT'"

	| mapping spec tables |
	mapping := self parseUnicodeOrgSpec: url.
	spec := self top128FromUnicodeSpec: mapping.
	tables := self tablesFromSpec: spec.
	^ self new
		identifier: url;
		byteToUnicode: tables first;
		unicodeToByte: tables second;
		yourself
]

{ #category : 'utilties' }
ZnByteEncoder class >> parseUnicodeOrgSpec: url [
	"Parse and return a mapping from byte to unicode values from url."
	"Basic syntax: lines starting with # are comments, else first two fields are read as 0x hex values"
	"self parseUnicodeOrgSpec: 'http://unicode.org/Public/MAPPINGS/ISO8859/8859-2.TXT'."

	| mapping |
	mapping := Dictionary new: 256.
	url asZnUrl retrieveContents linesDo: [ :each |
		(each isEmpty or: [ each beginsWith: '#' ])
			ifFalse: [ | tokens hexReader |
				hexReader := [ :string | Integer readFrom: (string readStream skip: 2; yourself) base: 16 ].
				tokens := each findTokens: String tab.
				(tokens size < 3 or: [ tokens last = '<control>' or: [ tokens last = '#UNDEFINED' ] ]) ifFalse: [
					mapping
						at: (hexReader value: tokens first)
						put: (hexReader value: tokens second) ] ] ].
	^ mapping
]

{ #category : 'utilties' }
ZnByteEncoder class >> top128FromUnicodeSpec: mapping [
	"Return an array mapping the top 128 byte to unicode values from a Unicode.org specification map"

	^ Array new: 128 streamContents: [ :stream |
		128 to: 255 do: [ :each |
			stream nextPut: (mapping at: each ifAbsent: [ nil ]) ] ]
]

{ #category : 'convenience' }
ZnByteEncoder >> decodeBytesIntoWideString: bytes [
	"Variant of #decodeBytes: that is faster when you know upfront
	that a WideString is probably needed"

	| byteStream |
	byteStream := bytes readStream.
	^ WideString streamContents: [ :stream |
		[ byteStream atEnd ] whileFalse: [
			stream nextPut: (self nextFromStream: byteStream) ] ]
]
